package com.unicomcz.commision;

import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.List;

import com.unicomcz.DetailPageAction;

public class DetailDsfAction extends DetailPageAction {
	
	private String curCommId;
    private String commRemarks;
    
    
	public String getCurCommId() {
		return curCommId;
	}

	public void setCurCommId(String curCommId) {
		this.curCommId = curCommId;
	}

	public String getCommRemarks() {
		return commRemarks;
	}

	public void setCommRemarks(String commRemarks) {
		this.commRemarks = commRemarks;
	}

	@Override
	public String getSqlStr() {
		String sql="SELECT depart_code 代理商,acct_month 月份,comm_name 品牌,'U'||to_char(user_id) 用户编号,serial_number 号码,recv_time 开户时间,comm_id 佣金编号,comm_name 佣金名, "+
				"rule_name 计算规则,'product_id' 套餐编号,'product_name' 套餐名,'user_state' 状态,'sanwu_tag' 是否3无,nvl(recv_fee,0) GPRS费用,nvl(commmoney,0) 佣金,0 开户预存, "+ 
				"0 分成,0 期数  "+
				"FROM dls_detail_dsf"+
				" WHERE depart_code = ? AND acct_month=? AND comm_id=? order by recv_time desc";
		return sql;
	}

	public Object[] getParams() {
        return new Object[]{userInfo.getDepartCode(),acctMonth,curCommId};
    }
    protected void regQueryParam() throws Exception{
        if ((acctMonth==null)||(acctMonth.length()==0)) {
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
            acctMonth=sf.format(new java.util.Date());
        }
        log.debug(acctMonth);
        log.debug(userInfo.getUserId());
        log.debug(curCommId);
        pstmt.setString(1, userInfo.getDepartCode());
        pstmt.setString(2, acctMonth);
        pstmt.setString(3, curCommId);
    }
    protected void rs2List(ResultSet rs,List out) throws Exception{
        CommDetailBean t = new CommDetailBean();
        t.setDepartId(rs.getString(1));
        t.setAcctMonth(rs.getString(2));
        t.setBrand(rs.getString(3));
       // t.setBrandSub(rs.getString(4));
        t.setUserId(rs.getString(4));
        t.setSerialNumber(rs.getString(5));
        t.setOpenTime(rs.getString(6));
        t.setCommId(rs.getString(7));
        t.setCommName(rs.getString(8));
        t.setCommRule(rs.getString(9));
        t.setProductId(rs.getString(10));
        t.setProductName(rs.getString(11));
        t.setStatus(rs.getString(12));
        t.setFlag3W(rs.getString(13));
        t.setGprs(rs.getString(14));
        //t.setHf(rs.getString(16));
        t.setYj(rs.getString(15));
        t.setOpenYcyf(rs.getString(16));
        t.setCommPer(rs.getString(17));
        t.setCommQishu(rs.getString(18));
        out.add(t);
    }

	
}
